import router from "@/router/router.ts";
import type { RouteLocationNormalized, NavigationGuardNext } from "vue-router";
import Nprogress from "nprogress";
import { getUserInfo } from "@/utils/localStorage.ts";
import { UserInfo } from "@/types/userTypes/userTypes.ts";

router.beforeEach((to: RouteLocationNormalized, from: RouteLocationNormalized, next: NavigationGuardNext): void => {
   Nprogress.start();
   const userInfo: UserInfo = getUserInfo<UserInfo>();
   next();
});

router.afterEach((to: RouteLocationNormalized, from: RouteLocationNormalized): void => {
   Nprogress.done();
});
